/**
 * 
 */
package de.nak.fireDepartment.service;

import java.util.Collection;

import de.nak.fireDepartment.exceptions.CarAlreadyExistsException;
import de.nak.fireDepartment.exceptions.CarNotFoundException;
import de.nak.fireDepartment.exceptions.EquipmentNotFoundException;
import de.nak.fireDepartment.exceptions.ErrorOnDeleteException;
import de.nak.fireDepartment.model.Car;

/**
 * Interface for the car service.
 * @author Nils Bredow
 */
public interface CarService {
	/**
	 * Creates a new car and stores it in the database.
	 * @throws EquipmentNotFoundException
	 * @throws CarAlreadyExistsException
	 *
	 */
	void createCar(String modelName,
				   String yearOfManufacture,
				   int enginePerformance,
				   int engineSize,
				   String manufactureCompany,
				   int measurementsLength,
				   int measurementsHigh,
				   int measurementsWidth,
				   int crew,
				   String descriptionText,
				   String imageURL,
				   Long[] equipmentIds) throws CarAlreadyExistsException, EquipmentNotFoundException;

	/**
	 * List all cars currently stored in the database.
	 *
	 * @return a list of Car entities. If no car was found an empty list is
	 *         returned.
	 */
	Collection<Car> listCars();

	/**
	 * Returns the car identified by the given id.
	 *
	 * @param id The identifier.
	 * @return the found entity.
	 * @throws CarNotFoundException
	 * @throws CarAlreadyExistsException 
	 */
	Car showCar(Long id) throws CarNotFoundException;

	/**
	 * Updates a car entity and stores the changes into the database
	 * 
	 * @param id
	 * @param modelName
	 * @param yearOfManufacture
	 * @param enginePerformance
	 * @param engineSize
	 * @param manufactureCompany
	 * @param measurementsLength
	 * @param measurementsHigh
	 * @param measurementsWidth
	 * @param crew
	 * @param descriptionText
	 * @param imageURL
	 * @param equipmentIds
	 * @throws EquipmentNotFoundException
	 * @throws CarAlreadyExistsException 
	 */
	void updateCar(long id,
				   String modelName,
				   String yearOfManufacture,
				   int enginePerformance,
				   int engineSize,
				   String manufactureCompany,
				   int measurementsLength,
				   int measurementsHigh,
				   int measurementsWidth,
				   int crew,
				   String descriptionText,
				   String imageURL,
				   Long[] equipmentIds) throws CarNotFoundException, EquipmentNotFoundException, CarAlreadyExistsException;

	/**
	 * Deletes the car with the given id.
	 *
	 * @param id The identifier.
	 * @throws ErrorOnDeleteException 
	 * @throws CarNotFoundException
	 */
	void deleteCar(Long id) throws CarNotFoundException, ErrorOnDeleteException;

}
